package com.gc.frontend.web.action.ajax;

import com.alibaba.fastjson.JSONObject;
import com.gc.frontend.service.CarService;
import com.gc.common.util.ReturnJsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 车辆的AJAX控制器
 * Created by 瑱彬 on 2015/4/2.
 */
@Controller
@RequestMapping("/ajax/car")
public class CarController {
    @Autowired
    private CarService carService;

    /**
     * 获取前台数据
     *
     * @return
     */
    @RequestMapping("/frontData")
    @ResponseBody
    public JSONObject getFrontData() {
        List<Map<String, Object>> frontData = this.carService.selectFront(null);
        return ReturnJsonUtil.successRows(frontData);
    }
}
